# -*- coding: utf-8 -*-
"""
    定义基础views层
"""
from flask import Blueprint, request, session, redirect, url_for

view_blue = Blueprint('view', __name__, url_prefix='/view')

from . import pusher, login

@view_blue.before_request
def before_request():
    if ("login" not in request.url) and ("register" not in request.url):
        # 判断session是否存在
        if "user_id" not in session:
            return redirect(url_for("view.login"))